import pytest, time
from selenium.webdriver.common.by import By


class ProductProviderLocator:
    """
        User Center 页面
    """
    # user portal 页面
    user_portal_page = (By.CSS_SELECTOR, '[id="root"]')
    # 初始页面展开的tab
    default_page_expanded = (By.CSS_SELECTOR, '[aria-expanded="true"]')

    # BILLS_tab
    bills_tab = (By.XPATH, "//div[contains(@data-menu-id,'BILLS')]")
    # user portal 页面左侧栏的BILLS下的Spending Summary按钮
    bills_spending_summary_title_btn = (By.CSS_SELECTOR, '[path="/work_bench/bills"]')
    # user portal 页面左侧栏的BILLS下的Billing Statement按钮
    bills_billing_statement_title_btn = (By.CSS_SELECTOR, '[path="/work_bench/billStatement"]')
    # Spending Summary页面
    bills_spending_summary_page = (By.XPATH, '//*[@class="cre-page-container-header-panel-left"]/span')
    # Billing Statement页面
    bills_billing_statement_page = (By.XPATH, '//*[@class="cre-page-container-header-panel-left"]/span')

    # Order Management_tab
    order_management_tab = (By.XPATH, "//div[contains(@data-menu-id,'ORDER_CST')]")
    # user portal 页面左侧栏的Order Management下的Orders按钮
    orders_title_btn = (By.CSS_SELECTOR, '[path="/work_bench/userCenter/order/order"]')
    # user portal 页面左侧栏的Order Management下的Resource Packages按钮
    resource_packages_title_btn = (By.CSS_SELECTOR, '[path="/work_bench/resource/packages"]')
    # user portal 页面左侧栏的Order Management下的My Resource按钮
    my_resource_title_btn = (By.CSS_SELECTOR, '[path="/work_bench/myResource"]')
    # user portal 页面左侧栏的Order Management下的Usage Query按钮
    usage_query_title_btn = (By.CSS_SELECTOR, '[path="/work_bench/usageQuery"]')

    # Orders页面
    orders_page = (By.XPATH, '//*[@class="cre-page-container-header-panel-left"]/span')
    # Resource Packages页面
    resource_packages_page = (By.XPATH, '//*[@class="cre-page-container-header-panel-left"]/span')
    # My Resource页面
    my_resource_page = (By.XPATH, '//*[@class="cre-page-container-header-panel-left"]/span')
    # Usage Query页面
    usage_query_page = (By.XPATH, '//*[@class="cre-page-container-header-panel-left"]/span')

    # Spending Summary页面的overview tab
    spending_summary_overview_tab = (By.CSS_SELECTOR, '[id="rc-tabs-0-tab-1"]')
    # Spending Summary页面detail tab
    spending_summary_detail_tab = (By.CSS_SELECTOR, '[id="rc-tabs-0-tab-2"]')

    # Spending Summary的overview页面产品名称字段
    spending_summary_overview_product_name = (By.XPATH, '(//*[@class="tableNormal___8JHCU"])[1]')
    # Spending Summary的overview页面产品提供者弹窗Provider: Flou
    spending_summary_overview_product_box = (By.CSS_SELECTOR, '[class="antd4-tooltip-inner"]')
    # Spending Summary的detail页面产品名称字段
    spending_summary_detail_product_name = (By.XPATH, '(//*[@style="white-space: nowrap;"])[1]')
    # Spending Summary的detail页面产品提供者弹窗Provider: Flou
    spending_summary_detail_product_box = (By.XPATH, "/html/body/div[4]/div/div/div/div[2]")
    # download按钮
    spending_summary_overview_download_button = (By.XPATH, "(//span[@class='anticon anticon-download'])[2]")
    # download按钮
    spending_summary_detail_download_button = (By.XPATH, "(//span[@class='anticon anticon-download'])[3]")

    # Orders的页面产品名称字段
    orders_product_name = (By.XPATH, '(//*[@style="white-space: nowrap;"])[1]')
    # Orders的页面产品提供者弹窗Provider: Flou cloud
    orders_product_box = (By.XPATH, '(//div[@class="antd4-tooltip-inner"])[1]')
    # Orders的页面订单名称order ID
    orders_product_order_id = (By.XPATH, '(//div[@class="cre-table-nowrap"])[1]')
    # Orders订单详情页面
    orders_detail_page = (By.XPATH, '(//*[@class="cre-page-container-header-panel-left"])/span[2]/div')
    # Orders的详情页面新增Provider字段
    orders_detail_provider_title = (By.XPATH, '(//*[@class="cre-descriptions-nowrap"])[4]')

    # Resource Packages的页面reset按钮
    resource_packages_product_name = (By.XPATH, '(//*[@style="white-space: nowrap;"])[1]')
    # Resource Packages的页面产品名称字段
    resource_packages_reset_button = (By.XPATH, '(//*[text()="Reset"])[1]')
    # Resource Packages的页面产品提供者弹窗Provider: Flou cloud
    resource_packages_product_box = (By.XPATH, '(//*[text()="Provider: tpartner"])[1]')
    # Resource Packages的页面订单名称order ID
    resource_packages_product_order_id = (By.XPATH, '//*[@id="rc-tabs-3-panel-Overview"]/div/div/div/div/div/div/div/table/tbody/tr[2]/td[1]/div')
    # Resource Packages订单详情页面
    resource_packages_detail_page = (By.XPATH, '(//*[@class="cre-page-container-header-panel-left"])/span/div')
    # Resource Packages的详情页面新增Provider字段
    resource_packages_detail_provider_title = (By.XPATH, '(//*[@class="cre-descriptions-nowrap"])[4]')

    # usage query页面产品下拉框
    usage_query_product_click_button =  (By.XPATH, '(//div[@class="antd4-select-selector"])[1]')
    # usage query页面产品下拉框的值all product
    usage_query_click_allproduct = (By.XPATH, '(//div[@title="All Products"])')
    # usage query的页面产品名称字段
    usage_query_packages_product_name = (By.XPATH, '(//*[@style="white-space: nowrap;"])[1]')
    # usage query的页面产品提供者弹窗Provider: Flou cloud
    usage_query_packages_product_box = (By.XPATH, "(//div[@class='antd4-tooltip-inner'])[1]")


    # 首页提示弹框返回按钮
    product_cancel_button = (By.XPATH,'/html/body/div[3]/div/div[2]/div/div[2]/div/div/div[2]/button[1]/span')

    # Billing Statement页面提示语信息  If you settle accounts by topping up, the system may update the outstanding amount after a certain delay.
    billing_statement_page_tips = (By.CSS_SELECTOR, '[class="antd4-alert-message"]')
    #  Billing Statement页面月账单字段Invoice No.
    billing_statement_invoice_no = (By.XPATH, '//*[@class="antd4-table-content"]/table/thead/tr/th[1]')
    #  Billing Statement页面月账单字段Billing Cycle
    billing_statement_billing_cycle = (By.XPATH, '//*[@class="antd4-table-content"]/table/thead/tr/th[2]')
    #  Billing Statement页面月账单字段Account Email
    billing_statement_account_email = (By.XPATH, '//*[@class="antd4-table-content"]/table/thead/tr/th[3]')
    #  Billing Statement页面月账单字段Status
    billing_statement_status = (By.XPATH, '//*[@class="antd4-table-content"]/table/thead/tr/th[4]')
    #  Billing Statement页面月账单字段Gross Amount (IDR)
    billing_statement_gross_amount = (By.XPATH, '//*[@class="antd4-table-content"]/table/thead/tr/th[5]')
    #  Billing Statement页面月账单字段Paid Amount (IDR)
    billing_statement_paid_amount = (By.XPATH, '//*[@class="antd4-table-content"]/table/thead/tr/th[6]')
    #  Billing Statement页面月账单字段Outstanding Amount (IDR)
    billing_statement_outstannding_amount = (By.XPATH, '//*[@class="antd4-table-content"]/table/thead/tr/th[7]')
    #  Billing Statement页面月账单字段Issue Date (UTC+08:00)
    billing_statement_issue_date = (By.XPATH, '//*[@class="antd4-table-content"]/table/thead/tr/th[8]')


    #page_total
    page_total=(By.CSS_SELECTOR,'[class="antd4-pagination-total-text"]')
    # my resource界面第一列product
    product_list = (By.XPATH, '(//td[contains(@class,"antd4-table-cell")])[2]')
    # my resource界面第一列product的属性
    product_provider = (By.XPATH, '(//*[text()="Provider: Flou cloud"])[1]')




    ##################################
    #Admin portal
    ##################################
    # Spending Summary界面
    # 初始页面展开的tab
    admin_default_page_expanded = (By.CSS_SELECTOR, '[aria-expanded="true"]')
    # BILLS_tab
    admin_bills_tab = (By.XPATH, "//div[contains(@data-menu-id,'BILLS_PLT')]")
    # 左侧栏的BILLS下的Spending Summary按钮
    admin_bills_spending_summary_title_btn = (By.CSS_SELECTOR, '[path="/console/bills"]')
    # Spending Summary页面
    admin_bills_spending_summary_page = (By.XPATH, '//div[@class="antd4-tabs antd4-tabs-top"]')

    # Spending Summary的overview页面Account Email下拉框
    overview_account_email_click_button =  (By.XPATH, '(//div[@class="antd4-select-selector"])[1]')
    # Account Email下拉框Personal/Enterprise
    overview_account_email_value_Personal = (By.XPATH, '(//div[@title="Personal/Enterprise"])')
    # Account Email输入框
    overview_account_email_value_Personal_input = (By.XPATH, '(//input[@aria-activedescendant="email_list_0"])[1]')
    # Search 按钮
    overview_Search = (By.XPATH, '(//div[@class="antd4-space-item"]//button[@type="submit"])[1]')
    # # product 字段
    overview_product = (By.XPATH, "(//td[@class='antd4-table-cell']/div[contains(@style,'white-space')][1])[1]")
    # product provider字段
    overview_product_provider = (By.XPATH, "(//div[@class='antd4-tooltip-inner'])[1]")
    # download按钮
    overview_download_button = (By.XPATH, "(//span[@class='anticon anticon-download'])[2]")


    # Spending Summary的detail分页
    admin_spending_summary_detail_tab = (By.XPATH, '//div[@class="antd4-tabs-tab"]/div[@role="tab"]')
    # Spending Summary的overview页面Account Email下拉框
    detail_account_email_click_button = (By.XPATH, '(//div[@class="antd4-select-selector"])[3]')
    # Account Email下拉框Personal/Enterprise
    detail_account_email_value_Personal = (By.XPATH, '(//div[@title="Personal/Enterprise"])')
    # Account Email输入框
    detail_account_email_value_Personal_input = (By.XPATH, '(//input[@aria-activedescendant="email_list_0"])[2]')
    # Search 按钮
    detail_Search = (By.XPATH, '(//div[@class="antd4-space-item"]//button[@type="submit"])[2]')
    # # product 字段
    detail_product = (By.XPATH, "(//td[@class='antd4-table-cell']/div[contains(@style,'white-space')][1])[10]")
    # product provider字段
    detail_product_provider = (By.XPATH, "(//div[@class='antd4-tooltip-inner'])[2]")
    # download按钮
    admin_detail_download_button = (By.XPATH, "(//span[@class='anticon anticon-download'])[3]")


    # Orders界面
    # orders_tab
    admin_orders_tab = (By.XPATH, "//div[contains(@data-menu-id,'ORDER_MANAGEMENT_PLT')]")
    # 左侧栏的order management下的order按钮
    admin_orders_title_btn = (By.CSS_SELECTOR, '[path="/console/orderManagement/order"]')
    # orders页面
    admin_orders_page = (By.XPATH, '//div[@class="antd4-spin-nested-loading"]')
    # product 字段
    orders_product = (By.XPATH, "//td[@class='antd4-table-cell']/div[contains(@style,'white-space')][1]")
    # product provider字段
    orders_product_provider = (By.XPATH, "(//div[@class='antd4-tooltip-inner'])[1]")

    # My resource界面
    # My resource_tab
    admin_my_resource_tab = (By.XPATH, "//div[contains(@data-menu-id,'ORDER_MANAGEMENT_PLT')]")
    # 左侧栏的order management下的My resource按钮
    admin_my_resource_title_btn = (By.CSS_SELECTOR, '[path="/console/orderManagement/myResource"]')
    # My resource页面
    admin_my_resource_page = (By.XPATH, '//div[@class="antd4-spin-nested-loading"]')
    # product 字段
    my_resource_product = (By.XPATH, "//td[@class='antd4-table-cell']/div[contains(@style,'white-space')][1]")
    # product provider字段
    my_resource_product_provider = (By.XPATH, "(//div[@class='antd4-tooltip-inner'])[1]")
